<template>
	<view>
		<page-head :title="'详情'" :headtype="2"></page-head>
		<view class="webblcok flex" style="width: 100vw;height:100vh;">
			<view class="marginAuto">
				<video id="myVideo" v-if="videourl" class="myVideo"
				:src="apifun.URLimg+videourl"
				@error="videoerrfun" @ended="videoendfun" controls></video>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				apifun:this.apifun,
				courseid:1,
				videourl:''
			};
		},
		onLoad(option) {
			this.courseid = option.courseid;
			this.videourl = uni.getStorageSync('videourl');
		},
		methods: {
			videoendfun(){
				let sendData = {
					course_id:this.courseid
				};
				this.apifun.unirequest('/api/topic/studyVideo','post',sendData,(res)=>{
					if(res.code === 200){
						let datas = res.data;
					}else{
						this.apifun.toast(res.msg)
					}
				})
			},
			videoerrfun(){
				this.apifun.toast('视频播放异常，请返回重新加载')
			}
		},
	};
</script>

<style scoped lang="scss">
	.webblcok{
		position:fixed;
		z-index: 0;
		top: 0;
		left: 0;
	}
	.myVideo{
		width:690rpx;
	}
</style>